<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>OA协同办公系统</title>
		<link type="text/css" rel="stylesheet" href="css/table.css">
		<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
		<script type="text/javascript" src="js/openwindow.js"></script>
		<script type="text/javascript" src="js//My97DatePicker/WdatePicker.js"></script>
		<script type="text/javascript">
function selectOrg(){
	var url="selectOrg.action";
	openWindow(url,650,550);
}
function selectRole(){
	var url="findAllRole.action";
	openWindow(url,300,250);
}
function checkValue(val){
	var reg=/^([1-9]+[0-9]*)$/;
	if(!reg.test(val.value)){
		val.value="";
	}
}

	function saveUser(){
		var name=$("#name").val();
		var account=$("#account").val();
		var organization=$("#organization").val();
		var px=$("#px").val();
		if($.trim(name)==''||$.trim(name)=='null'){
			alert("用户名不能为空！");
			return;
		}
		if($.trim(organization)==''||$.trim(organization)=='null'){
				alert("部门不能为空！");
				return;
		}
		if($.trim(px)==''||$.trim(px)=='null'){
			alert("排序不能为空！");
			 return;
		}
			$.post("updateUser.action",$("form").serialize(),function(data){
				if(data=='success'){
					alert("保存用户成功！");
					window.close();
					var currentPage=$("#currentPage").val();
					window.opener.page(currentPage);
				}else{
					alert("保存用户失败！");
				}
			});	
	}
		function getOldValue(){

		}
		function selectUser(){
		var url="selectUser.action";
		openWindow(url,750,400);
	}
	function addValue(id,name){
		$("#organizationId").val(id);
		$("#organization").val(name);
	}
	function addRole(ids,names){
		$("#roleId").val(ids);
		$("#role").val(names);
	}
function setValue(val){
	 var arr = eval(val);
	   var names = "";
	  var ids = "";
	  for(i=0;i<arr.length;i++){
	    ids =  ids + "," + arr[i].value;
	    names = names + "," + arr[i].name;
	  }
	  if(names.length>0){
	    names = names.substring(1);
	    ids =  ids.substring(1);
	  }
	  $("#pid").val(ids);
	  $("#pidName").val(names);
	}
	function valiadeVolume(ths){
		var reg=/^[1-9]\d*$/;
		if(!reg.test(ths.value)){
			ths.value=100;
		}
	}
</script>
	</head>
	<body>
	<table align="center" border="0" cellpadding="0" cellspacing="0"
			width="98%">
			<tbody>
				<tr>
					<td style="background: url('image/wsoa_window_002.gif');" width="1"></td>
					<td style="background: url('image/wsoa_window_002.gif');">
						<table border="0" cellpadding="0" cellspacing="0">
							<tbody>
								<tr>
									<td align="center"
										style="background: url('image/wsoa_window_002.gif');"
										width="10">
										<img src="image/center_19.gif">
									</td>
									<td align="center"
										style="background: url('image/wsoa_window_002.gif');"></td>
									<td>
										系统管理 &gt; 基础设置 &gt; 用户管理 &gt; 用户修改
									</td>
								</tr>
							</tbody>
						</table>
					</td>
					<td style="background: url('image/wsoa_window_002.gif');" width="1"></td>
				</tr>
				<tr>
					<td style="background: url('image/wsoa_window_010.gif');" width="1">
						&nbsp;
					</td>
					<td>
	
		<input type="hidden" id="currentPage" value="${currentPage}">
		<form action="updateUser.action" id="saveForm" method="post" name="saveForm">
			<input type="hidden" name="user.id" value="${user.id}">
			<input type="hidden" name="user.status" value="${user.status}">
			<input type="hidden" name="user.createTime" value="${user.createTime}">
			<input type="hidden" name="user.psw" value="${user.psw}">
			<table id="tabllist" class="table5" style="height: 300px" frame="box">
				<tr class="reigh_list2" style="height: 5px">
					<td colspan="4" align="center">
						修改用户
					</td>
				</tr>
				<tr>
					<td class="table5 bgcolor5" align="right" width="140px">
						帐户：
					</td>
					<td class="table5" align="left" width="350px">
						<input type="text" id="account" name="user.account"
							readonly="readonly" value="${user.account}" maxlength="15" />
						<span id="accountinfo"></span>
					</td>
					<td class="table5 bgcolor5" align="right" width="160px">
						姓名：
					</td>
					<td class="table5" align="left" width="350px">
						<input type="text" id="name" name="user.name" value="${user.name}"
							maxlength="20" />
						<span id="nameinfo"></span>
					</td>
				</tr>
				<tr>
					<td class="table5 bgcolor5" align="right" width="120px">
						职位：
					</td>
					<td class="table5" align="left" width="350px">
						<input value="${user.position}" type="text" name="user.position" maxlength="7" />
					</td>
					<td class="table5 bgcolor5" align="right" width="120px">
						手机：
					</td>
					<td class="table5" align="left" width="350px">
						<input value="${user.phone }" type="text" id="phone"
							name="user.phone" maxlength="15" />
					</td>
				</tr>
				<tr>
					<td class="table5 bgcolor5" align="right" width="120px">
						邮箱：
					</td>
					<td class="table5" align="left" width="350px">
						<input value="${user.email}" type="text" id="email"
							name="user.email" maxlength="15" />
					</td>
					<td class="table5 bgcolor5" align="right" width="120px">
						部门：
						<input type="hidden" name="user.orgId" id="organizationId"
							value="${user.orgId}" />
					</td>
					<td class="table5" align="left" width="350px">
						<input style="width: 180px" type="text" name="user.orgName"
							id="organization" readonly="readonly" value="${user.orgName}" />
						<input type="button" onclick="selectOrg()" class="sscc"
							style="position: absolute; + margin-top: 1px" />
						<span id="orginfo"></span>
					</td>
				</tr>
				<tr>
					<td class="table5 bgcolor5" align="right" width="120px">
						排序：
					</td>
					<td class="table5" align="left" width="350px">
						<input onkeyup="checkValue(this)" value="${user.px}" type="text"
							id="px" name="user.px" maxlength="7" />
					</td>
					<td class="table5 bgcolor5" align="right" width="120px">
						上级领导：
					</td>
						<input type="hidden" name="user.pid" id="pid" value="${user.pid}" />
					<td class="table5"  align="left" width="350px">
						<input style="width: 180px" type="text" name="pidName" id="pidName" readonly="readonly" value="${pidName}" />
						<input type="button" onclick="selectUser()" class="sscc" style="position: absolute; + margin-top: 1px" />
						<span id="orginfo"></span>
					</td>
				</tr>
				<tr>
					<td class="table5 bgcolor5" align="right" width="120px">
						邮箱容量：
					</td>
					<td class="table5" align="left" width="250px">
						<input value="${user.volume}" type="text" onkeyup="valiadeVolume(this)" id="volume"
							name="user.volume" maxlength="6" />&nbsp;&nbsp;M
					</td>
					<td class="table5 bgcolor5" align="right" width="120px">
						电话：
					</td>
					<td class="table5" align="left" width="350px">
						<input value="${user.telephone}" type="text" id="telephone"
							name="user.telephone" maxlength="15" />
					</td>
				</tr>
				<tr >
						<td class="table5 bgcolor5" align="right">
						所属角色：
					</td>
						<input type="hidden" name="roleId" id="roleId" value="${roleId}" />
					<td class="table5" align="left">
						<input style="width: 170px;" type="text" id="role"
							readonly="readonly" name="role" value="${role}" />
						<input onclick="selectRole()" type="button" class="sscc"
							style="position: absolute; + margin-top: 1px" />
						<span id="roleinfo"></span>
					</td>
					<td class="table5 bgcolor5" align="right" width="120px">
						参加工作时间：
					</td>
					<td class="table5" align="left" width="350px" >
						<input  type="text" id="workDate" name="user.workDate" readonly="readonly" class="Wdate" onclick="WdatePicker({dateFmt: 'yyyy', isShowToday: false, isShowClear: true});" maxlength="15" value="${user.workDate}" />
					</td>
				</tr>
				<tr>
				<td class="table5 bgcolor5" align="right" width="150px">
						身份证号：
					</td>
					<td class="table5" align="left">
						<input  type="text" id="number" name="user.number" value="${user.number}"  maxlength="25" />
					</td>
				</tr>
				<tr>
					<td align="center" colspan="4">
						<input type="button" onclick="saveUser()" value="保存" class="button_04" />
						<input type="button" onclick="window.close()" class="button_04" value="关闭" />
					</td>
				</tr>
			</table>
		</form>
		</td>
					<td style="background: url('image/wsoa_window_006.gif');" width="1">
						&nbsp;
					</td>
				</tr>
				<tr>
					<td height="1" width="1">
						<img src="image/wsoa_window_009.gif" height="16" width="14">
					</td>
					<td style="background: url('image/wsoa_window_008.gif');"
						height="1"></td>
					<td height="1" width="1">
						<img src="image/wsoa_window_007.gif" height="16" width="12">
					</td>
				</tr>
			</tbody>
		</table>
	</body>
</html>